package com.yanqu.road.server.timer.match;

import com.yanqu.road.server.manager.match.CrossMatchMgr;
import com.yanqu.road.utils.date.DateHelper;
import com.yanqu.road.utils.executor.GeneralTask;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * @author ：zfr
 * @date ：2021/3/22 0:17
 */
public class MatchRemoveDataTask extends GeneralTask {
    protected Logger logger = LogManager.getLogger(MatchRemoveDataTask.class.getName());

    private long lastUpdateTime = 0L;

    private static final long DELAY_MINUTE = 25 * 1000 * 60;   //0点25分
    @Override
    public void doRun() {
        //启动执行一次
        try {
            if (lastUpdateTime < DateHelper.getTodayZeroTimeStamp() + DELAY_MINUTE) {
                CrossMatchMgr.removeOutTimeData();
                lastUpdateTime = DateHelper.getTodayZeroTimeStamp() + DELAY_MINUTE;
            }
        }catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
    }
}
